home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_pow_backpack_m.cog < prev    next >
Text File  |  1998-02-25  |  2KB  |  81 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # POW_BACKPACK.COG
  4. #
  5. # POWERUP Script - Backpack
  6. #
  7. # [YB & CYW]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       powerup                          local
  15. thing       player                           local
  16. sound       pickupsnd=BactaPu1.wav           local
  17.  
  18. int         autopickup=0                     local
  19. int         autoselect_weapon=-1             local
  20.  
  21. message     touched
  22. message     taken
  23.  
  24. end
  25.  
  26. # ========================================================================================
  27.  
  28. code
  29.  
  30. touched:
  31.    player = GetSourceRef();
  32.    powerup = GetSenderRef();
  33.  
  34.    if (GetThingHealth(player) > 0)
  35.       TakeItem(powerup, player);
  36.  
  37.    Return;
  38.  
  39. # ........................................................................................
  40.  
  41. taken:
  42.    player = GetSourceRef();
  43.    powerup = GetSenderRef();
  44.  
  45.    jkPrintUNIString(player, 200);
  46.  
  47.    // Do effects.
  48.    PlaySoundLocal(pickupsnd, 1, 0, 0);
  49.    AddDynamicTint(player, 0.0, 0.0, 0.2);
  50.  
  51.    // Pickup the backpack
  52.    PickupBackpack(player, powerup);
  53.  
  54.    // New ammo is already assigned, so this is like a autopickup/autoreload mix,
  55.    // it will select the best weapon overall with all the stuff in the backpack
  56.    // taken into account.
  57.  
  58.    autopickup = GetAutoPickup();
  59.    autoselect_weapon = AutoSelectWeapon(player, 0);
  60.  
  61.    if(autopickup & 1)
  62.    {
  63.       if( !((autopickup & 2) && ((autoselect_weapon == 4) || (autoselect_weapon == 8) || (autoselect_weapon == 9)) ))
  64.       {
  65.          if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, autoselect_weapon, 0) )))
  66.          {
  67.             if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  68.             {
  69.                SelectWeapon(player, autoselect_weapon);
  70.                Return;
  71.             }
  72.          }
  73.       }
  74.    }
  75.  
  76.    Return;
  77.  
  78. end
  79.  
  80.  
  81.